﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:Phone.Framework.Controls">

    <Style x:Name="AppBarText"
           TargetType="ContentControl">
        <Setter Property="HorizontalAlignment"
                Value="Center" />
        <Setter Property="Margin"
                Value="0" />
        <Setter Property="Padding"
                Value="0" />
    </Style>
    <Style TargetType="local:RoundButton">
        <!--<Setter Property="Background" Value="{StaticResource PhoneBackgroundColor}"/>-->
        <Setter Property="BorderBrush" Value="{StaticResource PhoneContrastBackgroundBrush}"/>
		<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
		<Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/>
		<Setter Property="FontSize" Value="12" />
		<Setter Property="Padding" Value="10,3,10,5"/>
        <Setter Property="VerticalAlignment" Value="Top"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:RoundButton">
                    <StackPanel Orientation="{TemplateBinding Orientation}">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
								<VisualState x:Name="Normal" />
								<VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
									<Storyboard>
										<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="ButtonBackground">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneContrastBackgroundBrush}"/>
										</ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke" Storyboard.TargetName="ButtonBackground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneContrastBackgroundBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="ButtonForeground">
											<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneBackgroundBrush}"/>
										</ObjectAnimationUsingKeyFrames>
									</Storyboard>
								</VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke" Storyboard.TargetName="ButtonBackground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="ButtonBackground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource TransparentBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="ButtonForeground">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentBody">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
                                        </ObjectAnimationUsingKeyFrames>
                                        
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Grid Width="72" Height="72" Margin="0,-10, 0, -3">
                            <Ellipse
								x:Name="ButtonBackground"
								Stroke="{TemplateBinding BorderBrush}" 
								StrokeThickness="{StaticResource PhoneStrokeThickness}" 
								Fill="{TemplateBinding Background}" 
								Margin="{StaticResource PhoneTouchTargetOverhang}" />
							<Ellipse
								x:Name="ButtonForeground" 
								Fill="{TemplateBinding Foreground}" 
								Margin="{StaticResource PhoneTouchTargetOverhang}">
								<Ellipse.OpacityMask>
									<ImageBrush x:Name="OpacityImageBrush" />
								</Ellipse.OpacityMask>
							</Ellipse>
						</Grid>
                        
						<ContentControl 
                            x:Name="ContentBody" 
                            Content="{TemplateBinding Content}" 
                            FontSize="{TemplateBinding FontSize}"
                            Style="{StaticResource AppBarText}"/>
                    </StackPanel>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="local:ProgressOverlay">
        <Setter Property="Background"
                Value="{StaticResource PhoneSemitransparentBrush}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ProgressOverlay">
                    <Grid Background="{TemplateBinding Background}"
                          Name="LayoutGrid"
                          HorizontalAlignment="Stretch"
                          VerticalAlignment="Stretch">
                        <Grid.Resources>
                            <Storyboard x:Name="fadeOut">
                                <DoubleAnimation Duration="0:0:0.5"
                                                 To="0"
                                                 Storyboard.TargetProperty="(UIElement.Opacity)"
                                                 Storyboard.TargetName="LayoutGrid" />
                            </Storyboard>
                            <Storyboard x:Name="fadeIn">
                                <DoubleAnimation Duration="0:0:0.5"
                                                 From="0"
                                                 To="1"
                                                 Storyboard.TargetProperty="(UIElement.Opacity)"
                                                 Storyboard.TargetName="LayoutGrid" />
                            </Storyboard>
                        </Grid.Resources>
                        <Rectangle Fill="{StaticResource TransparentBrush}" />
                        <Grid>
                            <ContentControl Content="{TemplateBinding Content}"
                                            HorizontalContentAlignment="Stretch" />
                        </Grid>
                    </Grid>
                </ControlTemplate>

            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>